♻️ system prompt 治理与死代码清理(减法/中文化/when_to_use/死工具 13 件/死条目 10 条) - #276
Merged
Conversation
- 删除返回空串的僵尸段落函数与未引用常量 - 系统配置/工作区/Workspace Knowledge 三段合并为单一「工作区」段,去掉无用的 workspaceName 注入 - Execution Modes 与 Capability Routing 合并为单一决策阶梯,删除重复的 lightest 开头句与 brainstorming 重复行 - Loaded Context Policy 三行并入 Memory 段,随记忆工具条件注入 - TodoWrite 段 26→4 行:使用规则与 content/activeForm schema 由工具定义自足承担 - Office 段 47→16 行:删除 Python 示例(工具 schema 已含教学),路由清单按 availableTools 裁剪,消除宣称未注册工具的自相矛盾 - 删除 Expression Strategy 中无守卫的 image_gen 静态引用(工具为条件创建,无工具会话构成幻觉诱因) - Coding loop 收敛为三条硬规则(禁管道过滤验证命令/后台不轮询/禁自动 git 操作) - bypassPermissions 分支去除三遍重复强调,保留全部约束语义 - Tooling 4→1 行;Core Behavior 15→3 行,保留 persona 边界与提问规则 - 同步 6 个测试文件与 verify-prompt-alignment.ts 基线;新增 Coding loop 硬规则语义测试 Co-Authored-By: Claude <noreply@anthropic.com>
- 全部英文段落与标题译为中文:身份句/核心行为/工具使用/执行模式/安全契约/记忆/运行时/TodoWrite/内容呈现/浏览器优先标题/不确定性 default 分支/minimal 工作区段 - planner 子代理 prompt 中文化(explorer/researcher/code-reviewer 原即中文) - workspace-context 段:总标题/人设摘要/记忆摘要/引导句中文化 - 保留英文:工具名、角色名、schema 字段(content/activeForm/in_progress/subagent_type/task_ref)、claim 谓词、机器元数据行、命令与脚本名 - 同步 8 个测试文件与 verify-prompt-alignment.ts 断言;对齐脚本口径下 9473→5048 字符 - 范围外:后台子代理(dream/background-extractor/advisor)prompt 保持英文 Co-Authored-By: Claude <noreply@anthropic.com>
- Memory Brief 只承载数据(长期/近期),行为规则归「## 记忆」段单点声明 - skills 清单治理:header 5 行英文压 3 行中文;office 类 slug 在有内置 Office 工具时从清单隐藏(消除指令竞争);agent-* 描述保留 persona 映射 - thread_state 删 title/modelRef/modelId 渲染;插件 diagnostics 不再注入 - Office 工具路由表 8 行压 2 行(工具 schema 自足含教学) - 提问策略/人设安全/Skill 匹配时机收敛为单点声明 - file_reference_protocol 改引用式不重复绝对路径 - OpenConnector/deferred tools/browser/todo_state 五段英文中文化 - skill 清单接口随附删除未使用的 whenToUse 字段(全链删除见后继提交) Co-Authored-By: Claude <noreply@anthropic.com>
- <lume_memory_context> 头部 10 行英文指令压 4 行中文,删除与静态 prompt「## 记忆」「## 运行时」段重复的规则行(单点声明) - 六个 render 函数删除尾部空行元素,XML 块间零空行(标签自定界) - 工作区上下文子块间单空行,段尾不带空行(避免与外层 \n\n 叠加双空行) Co-Authored-By: Claude <noreply@anthropic.com>
when_to_use 非 Agent Skills 标准字段,且清单渲染从不消费(静默丢弃), 全链删除: - sdk:SkillDefinition 字段、fs-loader 解析、engine token 估算 - shared:SkillMeta / SaveWorkspaceSkillInput 类型 - sidecar:frontmatter 解析、rpc schema(strict)、编辑器校验与写回; 必填从「描述+触发条件+提示词」放宽为「描述+提示词」 - web:表单「触发条件」输入框、校验、列表展示、搜索字段、提交载荷 - 32 个内置 SKILL.md 删 frontmatter 行;skill-creator 教学正文同步 - 存量 SKILL.md 的 when_to_use 行成为 YAML 未知字段被安全忽略, legacy 测试钉死该容忍行为 Co-Authored-By: Claude <noreply@anthropic.com>
装配链验证(createBaseSdkAlignedTools → createLumeRuntimeTools → MCP/skill 动态注入)确认以下工具在三端与 sdk 内部均无消费者,仅剩定义+导出+注册自引用: - SendMessage / TeamCreate / TeamDelete(多代理消息与 team 机制未接入) - FindFiles(被 Glob 替代)/ ListWorkspaceTree(被 ListDirectory 替代) - ConfigTool(配置走 Lume 自身体系) - sdk 版 MCP resource 7 件(List/Read/Subscribe×2/Polling×2/McpAuth)—— sidecar 使用自建同名实现,sdk 版死链;setMcpConnections 的连接表唯一 读者即死工具,连同 agent.ts 调用一起删除 保留项:tool-approval 别名键 listmcpresources/readmcpresource(sidecar 自建同名工具经 allowed/disallowed 匹配仍可达);Task* 6 件(host-bound, sidecar createTaskTools 绑定)。 Co-Authored-By: Claude <noreply@anthropic.com>
- 删除已下线工具的 UI 元数据 9 条:send_message/team_create/team_delete/ config/subscribe_mcp_resource/unsubscribe_mcp_resource/subscribe_polling/ unsubscribe_polling/mcp_auth - 删除旧名残留 cron_set(实际工具已名 automation_set 且已有条目) - 同步 system-tools-state 分组判断:agent 组 5→2、automation 组 2→1, 断言钉死新计数 - 保留 list_mcp_resources/read_mcp_resource 两条(对应 sidecar 自建 同名活工具) Co-Authored-By: Claude <noreply@anthropic.com>
冲突解决:context-assembler browserFallbackPolicy 取 main 三态结构 (mcp__browser__* 新工具集 / legacy runtime / computer-use 回退), legacy 态文案保留本分支的中文翻译。 Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
对 sidecar agent system prompt 与工具面做持续治理(七个 commit):
<lume_memory_context>中文化+去重+空行消除when_to_use非标准字段全链删除when_to_use非标准字段全链删除Commit 1:减法(♻️ refactor)
删除(零行为影响)
~/.lume/lume.yaml、.context/用法、brainstorming 规则的逐字重复行image_gen的静态引用——image_gen 为条件创建工具,无工具会话中构成幻觉调用诱因合并(段落 17 → 14)
精简(schema 已承担的教学)
Commit 2:中文化(🌐 style)
Commit 3:动态注入段去重+中文化(♻️ refactor)
<working_directory>tag),不再重复绝对路径Commit 4:memory 召回前缀治理(♻️ refactor)
<lume_memory_context>头部 10 行英文指令压 4 行中文,删除与静态 prompt 段重复的规则行(单点声明);样例 660 字符(旧版仅指令即 ~1500)\n\njoin"叠加出的双空行Commit 5:
when_to_use全链删除(🔥 refactor)when_to_use非 Agent Skills 标准字段,且清单渲染从不消费(静默丢弃),删除:SkillDefinition字段、fs-loader 解析、engine token 估算SkillMeta/SaveWorkspaceSkillInput类型when_to_use行成为 YAML 未知字段被安全忽略,legacy 测试钉死该容忍行为保留决策(经验证)
subagent_typeschema 为静态描述、不反射注册表,此清单是模型发现内置子代理的唯一渠道有意的行为变化
whenToUse的旧载荷Commit 6:sdk 死工具删除(🔥 refactor)
装配链验证(
createBaseSdkAlignedTools→createLumeRuntimeTools→ MCP/skill 动态注入)确认 13 件工具在三端与 sdk 内部零消费:SendMessage / TeamCreate / TeamDelete(机制未接入)、FindFiles / ListWorkspaceTree(被 Glob / ListDirectory 替代)、ConfigTool、sdk 版 MCP resource 7 件——sidecar 用自建同名实现(tools/mcp/create-mcp-tools.ts),sdk 版及setMcpConnections死链(连接表唯一读者即死工具)整体删除。保留tool-approval别名键listmcpresources等(sidecar 同名工具经 allowed/disallowed 匹配仍可达)。Commit 7:工具设置页死条目清理(🔥 refactor)
tool-metadata.ts删除已下线工具的 UI 条目 9 条 + 旧名残留cron_set(实际工具已名automation_set且已有条目);同步system-tools-state分组判断与断言。保留list_mcp_resources/read_mcp_resource(sidecar 自建同名活工具)。验证
bun run typecheck六包全绿getEditableSkill导出缺失,与改动无关)run.test.ts:本轮引入的唯一真实回归(planner prompt 断言)已修复;其余失败项经 main baseline 对比 + 逐项-t单独重跑全过,确认为并发资源竞争 flaky(三次全量运行失败集合互不相同),transcript 一项 main 上同样红(预存)Follow-up
subagent_typeschema 动态反射注册表后,可进一步回收 prompt 中的角色清单CLAUDE_PLAN_MODE_SECTION常量名与产出内容(执行模式)不符,宜改名🤖 Generated with Claude Code